package com.diapoc.androidteacher;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.diapoc.androidteacher.CircleProgressBar.Activity_CircleProgressBar;
import com.diapoc.androidteacher.ColorProgressBar.Activity_ColorProgressBar;
import com.diapoc.androidteacher.PathMenu.Activity_PathMenu;
import com.diapoc.androidteacher.listview.Activity_ListView_ArrayAdapter;
import com.diapoc.androidteacher.listview.Activity_ListView_SimpleAdapter;

public class MainActivity extends Activity {

	private Context context;
	private String tag;

	Handler handler = new Handler() {
		@Override
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
		}
	};

	private void init() {
		context = this;
		tag = this.getLocalClassName();
		initLayout();
	}

	private void initLayout() {
		ListView lv = new ListView(context);
		String[] strs = { "简单列表", "图文列表", "环形进度条", "彩色进度条", "仿Path菜单栏" };
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_expandable_list_item_1, strs);
		lv.setAdapter(adapter);
		setContentView(lv);
		lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				switch (arg2) {
				case 0:
					context.startActivity(new Intent(context,
							Activity_ListView_ArrayAdapter.class));
					break;
				case 1:
					context.startActivity(new Intent(context,
							Activity_ListView_SimpleAdapter.class));
					break;
				case 2:
					context.startActivity(new Intent(context,
							Activity_CircleProgressBar.class));
					break;
				case 3:
					context.startActivity(new Intent(context,
							Activity_ColorProgressBar.class));
					break;
				case 4:
					context.startActivity(new Intent(context,
							Activity_PathMenu.class));
					break;
				}
			}
		});
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Log.v(tag, "onCreate");
		super.onCreate(savedInstanceState);
		// setContentView(R.layout.activity_main);
		init();
	}

	public void onStart() {
		Log.v(tag, "onStart");
		super.onStart();
	}

	public void onResume() {
		Log.v(tag, "onResume");
		super.onResume();
	}

	public void onPause() {
		Log.v(tag, "onPause");
		super.onPause();
	}

	public void onStop() {
		Log.v(tag, "onStop");
		super.onStop();
	}

	public void onDestroy() {
		Log.v(tag, "onDestroy");
		super.onDestroy();
	}

}
